package com.luban.springboot.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.luban.springboot.pojo.User;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/user")
@Api(tags="UserAPI")
public class UserController {
	
	 
	 @ApiOperation(value="用户新增", notes = "用户新增notes")
	 @PostMapping("add")
	 public Object addUser(){
		 Map<String,String> result = new HashMap<String,String>();
        result.put("respCode", "00");
        result.put("respMsg", "新增成功");
       return result;
	 }
	 
	 @ApiOperation(value="用户删除", notes = "用户删除notes")
	 @PostMapping("del/{id}")
	 public Object delUser(){
		 Map<String,String> result = new HashMap<String,String>();
         result.put("respCode", "00");
         result.put("respMsg", "删除成功");
       return result;
	 }
	 
     @ApiOperation(value="用户修改", notes = "用户修改notes")   
     @PostMapping("update")
     public Map<String,String> updateUser(){
		 Map<String,String> result = new HashMap<String,String>();
		 result.put("respCode", "00");
		 result.put("respMsg", "修改成功");
		 return result;
	 }

	 @ApiOperation(value="用户信息列表", notes = "用户信息列表notes")
	 @GetMapping("/show")
	 public Object showInfo(){
		 User user1 = new User(1,"女","小班友");
		 User user2 = new User(1,"男","小书包");
		 List<User> users = new ArrayList<>();
		 users.add(user1);
		 users.add(user2);
        return users;
	 }
}
